package com.bite.deom2;

import java.util.Arrays;

public class Test {

    public static void main(String[] args) {
        Student student1 = new Student("zhangsan", 18,70);
        Student student2 = new Student("lisi", 19,55);
        Student student3 = new Student("wangwu", 20,96);
        Student student4 = new Student("songliu", 28,80);
        Student student5 = new Student("kongqi", 16,90);

        Student[] students = {student1, student2, student3, student4, student5};

        IScoreComparator iScoreComparator = new IScoreComparator();
        IAgeComparator iAgeComparator = new IAgeComparator();
        INameComparator iNameComparator = new INameComparator();

        //用分数比较器比较
        Arrays.sort(students,iScoreComparator);
        System.out.println(Arrays.toString(students));
        System.out.println("=======================");

        //用年龄比较器比较
        Arrays.sort(students,iAgeComparator);
        System.out.println(Arrays.toString(students));
        System.out.println("=======================");

        //用名字比较器比较
        Arrays.sort(students,iNameComparator);
        System.out.println(Arrays.toString(students));
    }

}
